namespace com.ytocargo.EntityFramework.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddTables : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "YGFOC.YTO_BACKGROUNDJOB",
                c => new
                    {
                        ID = c.Decimal(nullable: false, precision: 10, scale: 0, identity: true),
                        JOBTYPE = c.String(nullable: false, maxLength: 512),
                        JOBARGS = c.String(nullable: false),
                        TRYCOUNT = c.Decimal(nullable: false, precision: 5, scale: 0),
                        NEXTTRYTIME = c.DateTime(nullable: false),
                        LASTTRYTIME = c.DateTime(),
                        ISABANDONED = c.Decimal(nullable: false, precision: 1, scale: 0),
                        PRIORITY = c.Decimal(nullable: false, precision: 3, scale: 0),
                        ISDELETE = c.Decimal(nullable: false, precision: 1, scale: 0),
                        DELETETIME = c.DateTime(),
                        DELETERID = c.Decimal(precision: 19, scale: 0),
                        MODIFYTIME = c.DateTime(),
                        MODIFIERID = c.Decimal(precision: 19, scale: 0),
                        CREATORID = c.Decimal(precision: 19, scale: 0),
                        CREATETIME = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "YGFOC.YTO_CHART",
                c => new
                    {
                        CHARTID = c.String(nullable: false, maxLength: 50),
                        AIRPORTICAO = c.String(maxLength: 4),
                        AIRPORTIATA = c.String(maxLength: 3),
                        CITYNAME = c.String(maxLength: 50),
                        AIRPORTNAME = c.String(maxLength: 50),
                        VALIDFROM = c.DateTime(),
                        VALIDUNTIL = c.DateTime(),
                        FILEPATH = c.String(maxLength: 200),
                        CHARTNAME = c.String(maxLength: 200),
                        FILESIZE = c.Decimal(nullable: false, precision: 19, scale: 0),
                        CHARTTYPEEX_CH = c.String(maxLength: 50),
                        MD5 = c.String(maxLength: 50),
                        AD_HP_ID = c.String(maxLength: 50),
                        PAGE_NUMBER = c.String(maxLength: 15),
                        IS_SUP = c.String(maxLength: 10, fixedLength: true, unicode: false),
                        SUP_REF_CHARTID = c.String(maxLength: 50),
                        IS_MODIFIED = c.String(maxLength: 10, fixedLength: true, unicode: false),
                    })
                .PrimaryKey(t => t.CHARTID);
            
            CreateTable(
                "YGFOC.YTO_FLIGHTINFO4MONITOR",
                c => new
                    {
                        ID = c.Decimal(nullable: false, precision: 10, scale: 0, identity: true),
                        FLIGHTID = c.Decimal(nullable: false, precision: 10, scale: 0),
                        COMPANYCODE2 = c.String(nullable: false, maxLength: 2),
                        COMPANYCODE3 = c.String(nullable: false, maxLength: 3),
                        FLTID = c.String(nullable: false, maxLength: 10),
                        FLTIDFIX = c.String(maxLength: 2),
                        FLTSEQ = c.Decimal(nullable: false, precision: 18, scale: 2),
                        FLTDATE = c.DateTime(nullable: false),
                        COSEQ = c.String(nullable: false, maxLength: 2),
                        FLTTASK = c.String(maxLength: 3),
                        SERVICETYPE = c.String(maxLength: 1),
                        FLTTYPE = c.String(nullable: false, maxLength: 1),
                        FLTOPTYPE = c.String(nullable: false, maxLength: 1),
                        FLTSTATUS = c.String(nullable: false, maxLength: 3),
                        CONFLTID = c.String(maxLength: 5),
                        CONFLTIDFIX = c.String(maxLength: 2),
                        CONCOMPANYCODE2 = c.String(maxLength: 2),
                        CONFLTDATE = c.DateTime(),
                        FLTLOOPID = c.String(maxLength: 7),
                        STD = c.DateTime(nullable: false),
                        STA = c.DateTime(nullable: false),
                        SCHDEPAPT = c.String(nullable: false, maxLength: 3),
                        SCHARRAPT = c.String(nullable: false, maxLength: 3),
                        ETD = c.DateTime(),
                        ETA = c.DateTime(),
                        DEPAPT = c.String(nullable: false, maxLength: 3),
                        ARRAPT = c.String(nullable: false, maxLength: 3),
                        LATESTOFFTIME = c.DateTime(),
                        LATESTONTIME = c.DateTime(),
                        LATESTOFFSTATUS = c.String(nullable: false, maxLength: 3),
                        LATESTONSTATUS = c.String(nullable: false, maxLength: 3),
                        DOORCLOSETIME = c.DateTime(),
                        OFFBLOCKTIME = c.DateTime(),
                        OUTTIME = c.DateTime(),
                        TAXIOUTTIME = c.DateTime(),
                        OFFTIME = c.DateTime(),
                        ONTIME = c.DateTime(),
                        TAXIINTIME = c.DateTime(),
                        INTIME = c.DateTime(),
                        ONBLOCKTIME = c.DateTime(),
                        DOORSOPNTIME = c.DateTime(),
                        STDSRC = c.String(maxLength: 15),
                        STASRC = c.String(maxLength: 15),
                        ETDSRC = c.String(maxLength: 15),
                        ETASRC = c.String(maxLength: 15),
                        LATESTOFFTIMESRC = c.String(maxLength: 15),
                        LATESTONTIMESRC = c.String(maxLength: 15),
                        LATESTOFFSTATUSSRC = c.String(maxLength: 15),
                        LATESTONSTATUSSRC = c.String(maxLength: 15),
                        DOORCLOSETIMESRC = c.String(maxLength: 15),
                        OFFBLOCKTIMESRC = c.String(maxLength: 15),
                        OUTTIMESRC = c.String(maxLength: 15),
                        TAXIOUTTIMESRC = c.String(maxLength: 15),
                        OFFTIMESRC = c.String(maxLength: 15),
                        ONTIMESRC = c.String(maxLength: 15),
                        TAXIINTIMESRC = c.String(maxLength: 15),
                        INTIMESRC = c.String(maxLength: 15),
                        ONBLOCKTIMESRC = c.String(maxLength: 15),
                        DOORSOPNTIMESRC = c.String(maxLength: 15),
                        LATESTUPDATESRC = c.String(nullable: false, maxLength: 15),
                        DEALTIME = c.DateTime(nullable: false),
                        FLTIDALTN = c.String(nullable: false, maxLength: 40),
                        FLTSEQREAL = c.Decimal(nullable: false, precision: 10, scale: 0),
                        FLTIDPK = c.String(nullable: false, maxLength: 40),
                        STARTCHECKTIME = c.DateTime(),
                        STDLOCAL = c.DateTime(nullable: false),
                        STALOCAL = c.DateTime(nullable: false),
                        ETDLOCAL = c.DateTime(),
                        ETALOCAL = c.DateTime(),
                        DOORCLOSETIMELOCAL = c.DateTime(),
                        OFFBLOCKTIMELOCAL = c.DateTime(),
                        OUTTIMELOCAL = c.DateTime(),
                        TAXIOUTTIMELOCAL = c.DateTime(),
                        OFFTIMELOCAL = c.DateTime(),
                        ONTIMELOCAL = c.DateTime(),
                        TAXIINTIMELOCAL = c.DateTime(),
                        INTIMELOCAL = c.DateTime(),
                        ONBLOCKTIMELOCAL = c.DateTime(),
                        DOORSOPNTIMELOCAL = c.DateTime(),
                        SOFLSEQNR = c.Decimal(nullable: false, precision: 19, scale: 0),
                        CHANGETIME = c.DateTime(nullable: false),
                        CARGODOORCLOSETIMELOCAL = c.DateTime(nullable: false),
                        GLOBALPK = c.String(maxLength: 11),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "YGFOC.YTO_GENERALDOC",
                c => new
                    {
                        ID = c.String(nullable: false, maxLength: 50),
                        TITLE = c.String(maxLength: 50),
                        CONTENT = c.String(maxLength: 200),
                        PARENTID = c.String(maxLength: 50),
                        DOCUMENT = c.String(maxLength: 200),
                        IS_MODIFIED = c.String(maxLength: 10, fixedLength: true, unicode: false),
                        PDFNAME = c.String(maxLength: 200),
                        VALIDFROM = c.DateTime(),
                        VALIDUNTIL = c.DateTime(),
                        FILESIZE = c.Decimal(nullable: false, precision: 19, scale: 0),
                        MD5 = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "YGFOC.YTO_SYSTEMSETTING",
                c => new
                    {
                        ID = c.Decimal(nullable: false, precision: 10, scale: 0, identity: true),
                        KEYNAME = c.String(),
                        KEYVALUE = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropTable("YGFOC.YTO_SYSTEMSETTING");
            DropTable("YGFOC.YTO_GENERALDOC");
            DropTable("YGFOC.YTO_FLIGHTINFO4MONITOR");
            DropTable("YGFOC.YTO_CHART");
            DropTable("YGFOC.YTO_BACKGROUNDJOB");
        }
    }
}
